#ifndef TCPSERVER_HPP
#define TCPSERVER_HPP

#include "Acceptor.hpp"
#include "EventLoop.hpp"

class TcpServer{
    using Callback = TcpConnectionCallback;
public:
    TcpServer(const string & ip, unsigned short port);
    ~TcpServer();

    // 服务器启动与停止
    void start();
    void stop();

    // 设置三个回调函数: 分别设置NewConnectionCallback，MessageCallback，CloseCallback
    void setAllCallback(Callback &&cb1, Callback &&cb2, Callback &&cb3);
    
private:
    Acceptor _acceptor;
    EventLoop _loop;
};

#endif